load("@nazel//:nazel_build.bzl", "nazel_cc_binary", "nazel_cc_library",  "nazel_cc_test")

package(default_visibility = ["//visibility:public"])

nazel_cc_library(
    name = "log",
    srcs = ["log.cc"],
    hdrs = ["log.h"],
    defines = [
        "BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG",
    ],
    linkopts = [
        "-lboost_date_time",
    ],
    deps = [
        "//cc/third_party:fmt",
        "@apiset//coin2:coin2_cpp",
        "@navi_third_party2//third_party/glog:glog",
    ],
)

nazel_cc_library(
    name = "time",
    srcs = [
        "time.cc",
    ],
    hdrs = [
        "time.h",
    ],
    defines = [
        "BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG",
    ],
    linkopts = [
        "-lboost_date_time",
    ],
    deps = [
        ":log",
        "//cc/third_party:fmt",
        "@apiset//coin2:coin2_cpp",
    ],
)

nazel_cc_library(
    name = "base",
    srcs = [
        "base64.cc",
        "config/app_config.cc",
        "config/args.cc",
        "file.cc",
        "scheduler.cc",
        "serial.cc",
        "unpacker.cc",
    ],
    hdrs = glob(["**/*.h"]),
    deps = [
        ":log",
        ":time",
        "//cc/coin2/base/window",
        "//cc/third_party:fmt",
        "//cc/third_party:toml11",
        "//cc/third_party/fast_double_parser",
        "@apiset//coin2:coin2_cpp",
    ],
)

nazel_cc_binary(
    name = "example_rate_limiter",
    srcs = ["example_rate_limiter.cc"],
    deps = [
        ":base",
    ],
)

nazel_cc_binary(
    name = "example_rate_limiter_coro",
    srcs = ["example_rate_limiter_coro.cc"],
    linkopts = [
        "-lboost_coroutine",
    ],
    deps = [
        ":base",
    ],
)


nazel_cc_test(
   name = "packer_test",
    srcs = [
        "packer_test.cc",
    ],
    linkopts = [
        "-lboost_coroutine",
    ],    
    deps = [
        ":base",
        "//cc/coin2/base/memory"
    ],
)

